<?php
require_once("config.php");
require_once("Lineup.php");

$dir = "./cache/events/";

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if($file != "." && $file != ".." && !is_dir($file)) {
                $filenameArr = explode(".", $file);
                if(!empty($filenameArr[0])) {
                    $location = $filenameArr[0];
                    //if the file is not updated the last 23,5 hours
                    if(Utility::fileLifetime($dir.$file) > 84600) {
                        Lineup::getEvents($location, true);
                    }
                }
            }
        }
        closedir($dh);
    }
}

?>